<template>
  <div id="localmac" class="tools">
    <el-descriptions title="本地计算机信息" :column="3" border>
      <el-descriptions-item label="计算机名称">
        {{form.hostname}}
      </el-descriptions-item>
      <el-descriptions-item label="计算机系统">
        {{form.platform}}
      </el-descriptions-item>
      <el-descriptions-item label="系统用户">
        {{form.username}}
      </el-descriptions-item>
      <el-descriptions-item :label="item.name" v-for="item in form.network" :key="item.name">
        <template v-for="addr in item.address" :key="addr.mac">
          <div>类型：{{addr.family}}</div>
          <div>IP地址：{{addr.address}}</div>
          <div>Mac地址：{{addr.mac}}</div>
        </template>
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>
<script setup lang="ts">
import { reactive } from 'vue';
// import { ref, reactive, getCurrentInstance, onMounted } from 'vue';
// import { ElTree, FormInstance } from 'element-plus';
// import { notifyType, notifyMessage } from '../../utils/common';
// import { AppStore } from '../../stores/store';
// let { proxy }: any = getCurrentInstance();
// let store = AppStore();
// let loading = ref(false);
// let loadingS = ref(false);
let form: any = reactive({
  hostname: '',
  platform: '',
  username: '',
  network: []
});

getOSInfo();

async function getOSInfo() {
  // let osInfo: any = await window.electron.ipcRenderer.invoke('get-os-info');
  // if (!osInfo) {
  //   return;
  // }
  // form.hostname = osInfo?.hostname;
  // form.platform =
  //   osInfo?.type + ' ' + osInfo?.release + ' , ' + osInfo?.platform + ' , ' + osInfo?.arch;
  // form.username = osInfo?.userInfo?.username;
  // let temp = Object.keys(osInfo?.network);
  // for (let key of temp) {
  //   form.network.push({ name: key, address: osInfo?.network[key] });
  // }
}
</script>
<style lang="scss">
#localmac {
}
</style>

